package com.tanoak.bootjpa.controller;

import com.tanoak.bootjpa.dao.HelloDao;
import com.tanoak.bootjpa.entity.Hello;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
 * @Author tanoak
 * Created By  on 2018/1/19
 * @Describe 测试 页面
 */
@Controller
public class HelloController {

    @Resource
    private HelloDao helloDao ;
    @RequestMapping("/helloTest")
    public Hello toTest(){
        return helloDao.findOne((long) 1);
//        return helloDao.findByName(1);
    }
    @RequestMapping("/test")
    public String test(Model model){
        Hello hello = helloDao.findOne((long) 1);
        String name = hello.getName();
        model.addAttribute("name",name) ;
        return "hello" ;
    }

}
